package com.drinkian.authentication.controller;

import com.drinkian.authentication.entity.po.User;
import com.drinkian.authentication.entity.vo.VUserToChangeStatus;
import com.drinkian.authentication.entity.vo.VUserUpdate;
import com.drinkian.authentication.service.IUserService;
import com.drinkian.entity.RequestResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("auth")
public class UserController {

    @Autowired
    private IUserService iUserService;

    @PostMapping("updateUser")
    public RequestResult updateUser(@RequestBody VUserUpdate vUserUpdate) {
        return iUserService.updateUser(vUserUpdate);
    }

    @GetMapping("getNewUserList")
    public RequestResult getNewUserList(@RequestParam("current") Integer current, @RequestParam("size") Integer size) {
        return iUserService.getNewUserList(current, size);
    }

    @GetMapping("permit")
    public RequestResult permit(@RequestParam("id") Long id) {
        return iUserService.permit(id);
    }

    @GetMapping("refuse")
    public RequestResult refuse(@RequestParam("id") Long id) {
        return iUserService.refuse(id);
    }

    @GetMapping("getAllUserAndRoleButSuperAdmin")
    public RequestResult getAllUserAndRoleButSuperAdmin(@RequestParam("current") Integer current, @RequestParam("size") Integer size) {
        return iUserService.getAllUserAndRoleButSuperAdmin(current, size);
    }

    @PostMapping("changeStatus")
    public RequestResult changeStatus(@RequestBody VUserToChangeStatus vUserToChangeStatus) {
        return iUserService.changeStatus(vUserToChangeStatus);
    }
}
